package frontend_package;

import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;

import java.awt.Color;

import javax.swing.LayoutStyle.ComponentPlacement;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.JLabel;
import javax.swing.SwingConstants;

import java.awt.Font;

/**
 * Note class.
 * 
 * @author Zheng Yang
 * 
 */
@SuppressWarnings("serial")
public class NotePanel extends JPanel {

	/**
	 * Create the panel.
	 */
	public NotePanel() {
		setBackground(Color.CYAN);

		JPanel OriginalQuestionPanel = new JPanel();
		OriginalQuestionPanel.setBackground(Color.WHITE);

		JPanel NotePanel = new JPanel();
		NotePanel.setBackground(Color.WHITE);

		JButton AlterButton = new JButton("Alter Answers");
		/**
		 * open Original Questions Panel when click "alter" by Zheng
		 */
		AlterButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				AnswersPanel answerPanel = new AnswersPanel();
				add(answerPanel);

			}
		});

		/** Button for questions and answers */
		JButton QueAnsButton = new JButton("New Qustions / Asnwers");
		/**
		 * open add new question or answer panel when click
		 * "New Questions/ Answers" by Zheng
		 */
		QueAnsButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				AddQuestionsPanel addQuesPanel = new AddQuestionsPanel();
				add(addQuesPanel);
			}
		});

		JLabel ListOfMyNotesLabel = new JLabel(
				"List Of My Notes (Questions or Answer or Both)");
		ListOfMyNotesLabel.setFont(new Font("Tempus Sans ITC", Font.BOLD, 18));
		ListOfMyNotesLabel.setForeground(new Color(0, 0, 0));
		ListOfMyNotesLabel.setHorizontalAlignment(SwingConstants.CENTER);
		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout
				.setHorizontalGroup(groupLayout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								Alignment.TRAILING,
								groupLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.TRAILING)
														.addComponent(
																ListOfMyNotesLabel,
																Alignment.LEADING,
																GroupLayout.DEFAULT_SIZE,
																780,
																Short.MAX_VALUE)
														.addGroup(
																groupLayout
																		.createSequentialGroup()
																		.addGroup(
																				groupLayout
																						.createParallelGroup(
																								Alignment.TRAILING)
																						.addComponent(
																								AlterButton,
																								GroupLayout.DEFAULT_SIZE,
																								212,
																								Short.MAX_VALUE)
																						.addComponent(
																								QueAnsButton,
																								GroupLayout.DEFAULT_SIZE,
																								212,
																								Short.MAX_VALUE))
																		.addGap(18)
																		.addComponent(
																				NotePanel,
																				GroupLayout.PREFERRED_SIZE,
																				257,
																				GroupLayout.PREFERRED_SIZE)
																		.addGap(29)
																		.addComponent(
																				OriginalQuestionPanel,
																				GroupLayout.PREFERRED_SIZE,
																				264,
																				GroupLayout.PREFERRED_SIZE)))
										.addGap(35)));
		groupLayout
				.setVerticalGroup(groupLayout
						.createParallelGroup(Alignment.TRAILING)
						.addGroup(
								groupLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												groupLayout
														.createParallelGroup(
																Alignment.TRAILING)
														.addComponent(
																OriginalQuestionPanel,
																GroupLayout.PREFERRED_SIZE,
																365,
																GroupLayout.PREFERRED_SIZE)
														.addGroup(
																groupLayout
																		.createSequentialGroup()
																		.addComponent(
																				ListOfMyNotesLabel,
																				GroupLayout.PREFERRED_SIZE,
																				75,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				ComponentPlacement.RELATED)
																		.addGroup(
																				groupLayout
																						.createParallelGroup(
																								Alignment.LEADING)
																						.addGroup(
																								groupLayout
																										.createSequentialGroup()
																										.addPreferredGap(
																												ComponentPlacement.RELATED,
																												35,
																												Short.MAX_VALUE)
																										.addComponent(
																												NotePanel,
																												GroupLayout.PREFERRED_SIZE,
																												365,
																												GroupLayout.PREFERRED_SIZE))
																						.addGroup(
																								groupLayout
																										.createSequentialGroup()
																										.addGap(260)
																										.addComponent(
																												AlterButton,
																												GroupLayout.PREFERRED_SIZE,
																												57,
																												GroupLayout.PREFERRED_SIZE)
																										.addPreferredGap(
																												ComponentPlacement.RELATED,
																												29,
																												Short.MAX_VALUE)
																										.addComponent(
																												QueAnsButton,
																												GroupLayout.PREFERRED_SIZE,
																												54,
																												GroupLayout.PREFERRED_SIZE)))))
										.addGap(34)));
		setLayout(groupLayout);

	}
}
